package com.tedu.springdemo.day04;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

//实例工厂      方法：返回值 返回对象
//@Bean 注解      用于方法上，返回一个对象

@Component
public class NetConnInstanceFactory {
    @Bean("nc")
    public NetConnection getInstance(){
        NetConnection nc=new NetConnection();
        nc.lode();
        nc.ping();
        nc.conn();
        return nc;
    }
}
